package com.company.cloud.user.modules.app.service.impl;

import cn.hutool.core.util.StrUtil;
import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.common.utils.CheckUtils;
import com.company.cloud.user.config.UserCenterConfig;
import com.company.common.server.config.cloud.ProjectConfig;
import com.company.common.server.sms.CloudSmsAliyunKit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.company.cloud.common.asserts.ValidatorUtils;
import com.company.cloud.user.modules.app.models.SendVerificationCodeDto;
import com.company.cloud.user.modules.app.service.VCodeSmsService;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

/**
 * 短信 serviceImpl
 *
 * @author limj
 * @date 2020-06-17
 */
@Slf4j
@Service
public class VCodeSmsServiceImpl implements VCodeSmsService {


//    @Autowired
//    private MessageSMSRemoteService messageSMSRemoteService;


    @Autowired
    private ProjectConfig projectConfig;
    @Autowired
    private UserCenterConfig userCenterConfig;
//    @Autowired
//    private MessageSMSRemoteServiceImpl messageSMSRemoteServiceImpl;

    @Override
    public void sendVerificationCode(SendVerificationCodeDto param) {
        ValidatorUtils.validate(param);
        log.debug("++++++ SmsService:sendVerificationCode 发送验证码...");
        System.out.println( StrUtil.format("++++++++++++手机号:{}，验证码:{}",param.getMobile(),param.getVerificationCode()));

        Map<String, String> templateParam=new HashMap<String, String>();
        templateParam.put("code", param.getVerificationCode());
        CloudSmsAliyunKit.sendSms(param.getMobile(),"SMS_172735715",templateParam);


    }



}
